package arrays

// HasDuplicates 判断数组中是否有重复的元素
func HasDuplicates[T comparable](array []T) bool {
	seen := make(map[T]struct{}, len(array))
	for _, value := range array {
		if _, ok := seen[value]; ok {
			return true
		}
		seen[value] = struct{}{}
	}
	return false
}
